import { IFeidaoAiBrowserComponent } from '@dfeidao/atom-web/interfaces';
import set from '@dfeidao/atom-web/local/set';
// import get from '@dfeidao/atom-web/local/get';
import nodejs from '@dfeidao/atom-web/msg/nodejs';
import render from '@dfeidao/atom-web/render/render';
import pn_sty from '@dfeidao/fd-w000010';
import p001 from './p001';


export default async function a001(fd: IFeidaoAiBrowserComponent, a: { page_no: number }) {
	// todo
	// a: { page_no: number }
	const v1 = fd.data.node.querySelector<HTMLSelectElement>('[data-id="select_1"]');
	const v2 = fd.data.node.querySelector<HTMLInputElement>('[data-id="equip_name_1"]');
	const v3 = fd.data.node.querySelector<HTMLSelectElement>('[data-id="select_1"]');
	const pn = a.page_no || 1;
	const res = await nodejs('device-management-ygh/zj-000002/s001', {
		page: {
			value1: v1.value,
			value2: v2.value,
			value3: v3.value,
			page_no: Number(pn) || 1
		}
	});
	console.log(res);
	render(fd, res, p001, 'p001', 'inner');
	const p = fd.data.node.querySelector<pn_sty>('[data-id="p_n"]');
	p.setAttribute('page-no', pn + '');

	set(fd, 'page-no', pn);
}
